//
//  CYRechargeSuccessViewController.m
//  cyjf
//
//  Created by tauCross on 2017/5/22.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "CYRechargeSuccessViewController.h"

#import "CYMainController.h"



@interface CYRechargeSuccessViewController ()

@property(nonatomic, strong)UIImageView *iconImageView;
@property(nonatomic, strong)UILabel *titleLabel;
@property(nonatomic, strong)UILabel *hintLabel;

@property(nonatomic, strong)UIButton *investButton;

@end


@implementation CYRechargeSuccessViewController

- (void)loadUI
{
    self.navigationItem.title = @"充值成功";
    
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    self.tableView.hidden = YES;
    
    self.iconImageView = [[UIImageView alloc] initWithImage:CYImage(@"ico_recharge_sucess_blue")];
    [self.contentView addSubview:self.iconImageView];
    
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.text = @"充值成功";
    self.titleLabel.textColor = HEXCOLOR(@"444444");
    self.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightRegular];
    [self.titleLabel sizeToFit];
    [self.contentView addSubview:self.titleLabel];
    
    self.hintLabel = [[UILabel alloc] init];
    self.hintLabel.numberOfLines = 0;
    self.hintLabel.textAlignment = NSTextAlignmentCenter;
    self.hintLabel.textColor = HEXCOLOR(@"999999");
    self.hintLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
    self.hintLabel.text = @"您的资金现已进入第三方支付银行备用金账户，赶紧去投资吧。";
    self.hintLabel.size = [self.hintLabel sizeThatFits:CGSizeMake(SCREEN_WIDTH - 80, MAXFLOAT)];
    [self.contentView addSubview:self.hintLabel];
    
    self.investButton = [[UIButton alloc] init];
    self.investButton.layer.masksToBounds = YES;
    self.investButton.layer.cornerRadius = 4;
    self.investButton.layer.borderColor = HEXCOLOR(@"3E8CE6").CGColor;
    self.investButton.layer.borderWidth = 1;
    [self.investButton setTitle:@"立即投资" forState:UIControlStateNormal];
    [self.investButton setTitleColor:HEXCOLOR(@"3E8CE6") forState:UIControlStateNormal];
    self.investButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
    [self.investButton addTarget:self action:@selector(onInvestButtonTouchUpInside) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.investButton];

}

- (void)layoutUI
{
    self.iconImageView.centerX = self.contentView.width / 2;
    self.iconImageView.top = 40;
    
    self.titleLabel.centerX = self.contentView.width / 2;
    self.titleLabel.centerY = 123;
    
    self.hintLabel.centerX = self.contentView.width / 2;
    self.hintLabel.top = self.titleLabel.bottom + 18;
    
    self.investButton.width = self.contentView.width - 40;
    self.investButton.height = 44;
    self.investButton.centerX = self.contentView.width / 2;
    self.investButton.top = self.hintLabel.bottom + 43;
}

#pragma mark - Actions
- (void)investAction
{
    [[CYMainController standardController] goFinance];
}

#pragma mark - Control Events
- (void)onInvestButtonTouchUpInside
{
    [self investAction];
}

@end
